<template>
    <view class="dividend_outer">
        <view class="dividend_outer_box">
            <view class="dividend_header">
                <view class="dividend_header_box">
                    <view class="dividend_header_back" @click="GoBack">
                        <image src="@/static/dividend/back.png"></image>
                    </view>
                    <view class="dividend_header_title">订单列表</view>
                </view>
            </view>
            <view class="reward_tabs">
                <circleTabs v-model="tabIndex" :tabList="list" mode="skew"></circleTabs>
            </view>
        </view>
        <scroll-view :scroll-y="true" class="record_list" :style="{ height: rewardRecordListHeight + 'rpx' }"
            @scrolltolower="refreshList">
            <view class="record_item" v-for="item, index in 10" :key="index" @click="toGoodsListPage">
                <view class="record_item_left">
                    <view class="record_item_left_top"><text>这是一段描述这是一段描述限制字符19...</text></view>
                    <view class="record_item_left_down"><text>2024/02/03 15:56:56</text></view>
                </view>
                <view class="record_item_right" v-if="tabIndex == 0">
                    <!-- <text class="add" v-if="item.num > 0">+{{ Math.floor(item.num) / 1000 }}K</text>
                    <text class="subtract" v-else>{{ Math.floor(item.num) / 1000 }}K</text> -->
                    <text>+8888</text>
                    <!-- <view class="record_item_right_success">交易成功</view> -->
                    <!-- <view class="record_item_right_error">交易失败</view> -->
                    <view class="record_item_right_refund">已退款</view>
                </view>
                <view class="record_item_right" v-if="tabIndex == 1">
                    <!-- <text class="add" v-if="item.num > 0">+{{ item.num.toFixed(5) }}</text>
                    <text class="subtract" v-else>{{ item.num.toFixed(5) }}</text> -->
                    <text>+8888</text>
                    <view class="record_item_right_success">交易成功</view>
                    <!-- <view class="record_item_right_error">交易失败</view> -->
                    <!-- <view class="record_item_right_refund">已退款</view> -->
                </view>
            </view>
        </scroll-view>
    </view>
</template>

<script>
import { reqDividendList } from '@/api/dividend.js'
import circleTabs from "@/components/circle-tabs/circle-tabs.vue";

export default {
    data() {
        return {
            // 钻石手续费奖励与云豆手续费奖励切换
            tabIndex: 0,
            // 转赠与转赠列表list
            list: [
                {
                    id: 0,
                    title: "金豆订单",
                },
                {
                    id: 1,
                    title: "云豆订单",
                },
            ],
            rewardRecordListHeight: 0
        }
    },
    onLoad() {
        this.computedHeight()
    },
    methods: {
        GoBack() {
            uni.switchTab({
                url: "/pages/my/index",
            });
        },

        computedHeight() {
            uni.getSystemInfo({
                success: (res) => {
                    const screenHeight = res.windowHeight; // 屏幕高度，单位为px
                    this.rewardRecordListHeight = this.$pxToRpx(screenHeight) - 320;
                },
            });
        },
        // 跳转订单详情页面
        toGoodsListPage() {
            console.log(898);
            uni.navigateTo({
                url: "/pages/goodsDetail/index",
            });
        },
    },

    components: {
        circleTabs
    }
}
</script>

<style lang="scss" scoped>
.dividend_outer {
    width: 100vw;
    height: 100vh;
    background: #FFFAEF;

    .dividend_outer_box {
        height: 320rpx;
    }

    .dividend_header {
        width: 750rpx;
        height: 301rpx;
        background: linear-gradient(180deg, #FF811B 0%, #FFA748 100%);
        border-radius: 0rpx 0rpx 0rpx 0rpx;
        opacity: 1;

        .dividend_header_box {
            width: 100%;
            display: flex;
            align-items: center;
            padding-top: 74rpx;
            position: relative;
        }

        .dividend_header_back {
            width: 46rpx;
            height: 46rpx;
            margin-left: 44rpx;

            image {
                width: 100%;
                height: 100%;
            }
        }

        .dividend_header_title {
            margin: 0 auto;
            padding-right: 90rpx;
            font-size: 46rpx;
            font-family: Inter, Inter;
            font-weight: 600;
            color: #FFFFFF;
        }

    }

    .reward_tabs {
        margin-top: -80rpx;
    }

    .record_list {
        width: 100vw;

        .record_item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 2rpx solid rgb(183, 178, 169, 0.35);
            padding: 42rpx 0;

            .record_item_left {
                margin-left: 44rpx;
                display: flex;
                flex-direction: column;
                row-gap: 16rpx;

                .record_item_left_top {
                    font-size: 29rpx;
                    font-family: Inter, Inter;
                    font-weight: 500;
                    color: #302B26;
                }

                .record_item_left_down {
                    font-size: 26rpx;
                    font-family: Inter, Inter;
                    font-weight: 400;
                    color: #6C6862;


                }
            }

            .record_item_right {
                margin-right: 44rpx;

                .record_item_right_success {
                    width: 131rpx;
                    height: 54rpx;
                    background: rgb(255, 140, 40, 0.1);
                    border-radius: 10rpx 10rpx 10rpx 10rpx;
                    font-family: PingFang SC, PingFang SC;
                    font-weight: 500;
                    font-size: 26rpx;
                    color: #FF8C28;
                    line-height: 54rpx;
                    text-align: center;
                }

                .record_item_right_error {
                    width: 131rpx;
                    height: 54rpx;
                    background: rgb(252, 65, 0, 0.1);
                    border-radius: 10rpx 10rpx 10rpx 10rpx;
                    font-family: PingFang SC, PingFang SC;
                    font-weight: 500;
                    font-size: 26rpx;
                    color: #FC4100;
                    line-height: 54rpx;
                    text-align: center;
                }

                .record_item_right_refund {
                    width: 131rpx;
                    height: 54rpx;
                    background: rgb(153, 153, 153, 0.1);
                    border-radius: 10rpx 10rpx 10rpx 10rpx;
                    font-family: PingFang SC, PingFang SC;
                    font-weight: 500;
                    font-size: 26rpx;
                    color: #999999;
                    line-height: 54rpx;
                    text-align: center;
                }

                .add {
                    font-size: 38rpx;
                    font-family: Inter, Inter;
                    font-weight: normal;
                    color: #FC4100;
                }

                .subtract {
                    font-size: 38rpx;
                    font-family: Inter, Inter;
                    font-weight: 600;
                    color: #000000;
                }
            }
        }
    }
}
</style>